USE [master]
GO

-- Get the SQL Server data path
DECLARE @data_path nvarchar(256);
SET @data_path = (SELECT SUBSTRING(physical_name, 1, CHARINDEX(N'master.mdf', LOWER(physical_name)) - 1)
                  FROM master.sys.master_files
                  WHERE database_id = 1 AND file_id = 1);

-- Drop database ParvisTest if it exists
IF db_id('ParvisTest') IS NOT NULL
	DROP DATABASE ParvisTest;


-- execute the CREATE DATABASE statement 
EXECUTE ('CREATE DATABASE ParvisTest 
ON
PRIMARY  
    (NAME = ParvisTest, FILENAME = '''+ @data_path + 'ParvisTest.mdf'', SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB)
LOG ON 
   (NAME = ParvisTest_log, FILENAME = '''+ @data_path + 'ParvisTest_log.ldf'', SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)');
GO
EXEC dbo.sp_dbcmptlevel @dbname=N'ParvisTest', @new_cmptlevel=90
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [ParvisTest].[dbo].[sp_fulltext_database] @action = 'disable'
end
GO
ALTER DATABASE [ParvisTest] SET ANSI_NULL_DEFAULT OFF 
GO
ALTER DATABASE [ParvisTest] SET ANSI_NULLS OFF 
GO
ALTER DATABASE [ParvisTest] SET ANSI_PADDING OFF 
GO
ALTER DATABASE [ParvisTest] SET ANSI_WARNINGS OFF 
GO
ALTER DATABASE [ParvisTest] SET ARITHABORT OFF 
GO
ALTER DATABASE [ParvisTest] SET AUTO_CLOSE OFF 
GO
ALTER DATABASE [ParvisTest] SET AUTO_CREATE_STATISTICS ON 
GO
ALTER DATABASE [ParvisTest] SET AUTO_SHRINK OFF 
GO
ALTER DATABASE [ParvisTest] SET AUTO_UPDATE_STATISTICS ON 
GO
ALTER DATABASE [ParvisTest] SET CURSOR_CLOSE_ON_COMMIT OFF 
GO
ALTER DATABASE [ParvisTest] SET CURSOR_DEFAULT  GLOBAL 
GO
ALTER DATABASE [ParvisTest] SET CONCAT_NULL_YIELDS_NULL OFF 
GO
ALTER DATABASE [ParvisTest] SET NUMERIC_ROUNDABORT OFF 
GO
ALTER DATABASE [ParvisTest] SET QUOTED_IDENTIFIER OFF 
GO
ALTER DATABASE [ParvisTest] SET RECURSIVE_TRIGGERS OFF 
GO
ALTER DATABASE [ParvisTest] SET  ENABLE_BROKER 
GO
ALTER DATABASE [ParvisTest] SET AUTO_UPDATE_STATISTICS_ASYNC OFF 
GO
ALTER DATABASE [ParvisTest] SET DATE_CORRELATION_OPTIMIZATION OFF 
GO
ALTER DATABASE [ParvisTest] SET TRUSTWORTHY OFF 
GO
ALTER DATABASE [ParvisTest] SET ALLOW_SNAPSHOT_ISOLATION OFF 
GO
ALTER DATABASE [ParvisTest] SET PARAMETERIZATION SIMPLE 
GO
ALTER DATABASE [ParvisTest] SET  READ_WRITE 
GO
ALTER DATABASE [ParvisTest] SET RECOVERY FULL 
GO
ALTER DATABASE [ParvisTest] SET  MULTI_USER 
GO
ALTER DATABASE [ParvisTest] SET PAGE_VERIFY CHECKSUM  
GO
ALTER DATABASE [ParvisTest] SET DB_CHAINING OFF 